import React, { PureComponent } from 'react'

class MixinComp extends PureComponent {
  state = {
    visible: false,
  }

  open = () => {
    this.setState({ visible: true });
  }

  close = () => {
    this.setState({ visible: false });
  }

  render() {
    const { visible } = this.state;
    const childrenProps = { ...this.props, close: this.close };
    return (
      <div visible={ visible }>
        <div { ...childrenProps }/>
      </div>
    );
  }
};

export default MixinComp;
